#$@ 目标文件  $^所有依赖文件  $<第一个依赖文件
CXX			:= g++
CXXFLAGS	:= -g -O2 -Wall -Werror -Wno-unused
SRCS 		:= $(wildcard *.cpp)
#$(warning SRCS is $(SRCS))
OBJS 		:= $(patsubst %.cpp, %.o, $(SRCS))
#$(warning OBJS is $(OBJS))

TARGET		:= template

ROOT_DIR    = $(shell pwd)
$(warning ROOT_DIR is $(ROOT_DIR))

#OBJ_DIRS	+= $(ROOT_DIR)/OBJ

LIB_INC_DIRS += $(ROOT_DIR)/INC/
STATIC_LIB_DIRS += $(ROOT_DIR)/LIB/

INC_DIRS	+= -I $(ROOT_DIR)/INC/
LIB_DIRS	+= -L $(ROOT_DIR)/LIB/

LIBS		+= \
			-larray\
			-lconst_interger\
			-ldynamic_array\
			-lfunction_refer\
			-llambda\
			-lnew_del\
			-lpointer_demo\
			-lvariable_types\
			-lstring\
			-lbasic_class\
			-lconstructor_class\
			-ldestructor_class\
			-lconstructor_copy_class\
			-lconstructor_single_sample_class\
			-lsizeof_class\
			-lfriend_class\
			-lthis_pointer\
			-lbasic_class_inherit_derive\
			-ldestructor_derive_class

export CXX CXXFLAGS SRCS OBJS ROOT_DIR

#link
$(TARGET):$(OBJS)
	$(CXX) $^ -o $@ $(INC_DIRS) $(LIB_DIRS) $(LIBS)

#compile
$(OBJS):
	$(CXX) -c $(CXXFLAGS) $(SRCS)

.PHONY:help
.PHONY:clean
.PHONY:run

help:
	@echo -e "\e[46m [make ] \e[0m";
	@echo -e "\e[45m [make clean] \e[0m";
	@echo -e "\e[44m [make run] \e[0m";
run:
	./$(TARGET).exe

clean:
	rm -rf ./*.o
	rm -rf $(TARGET).exe

